// Copyright Notice:
//				dojo_config.js v1.0.1
//			Copyright@2008-2009 - OpenSiteMobile
//				All rights reserved
// ==========================================================================
//			http://www.opensitemobile.com
// ==========================================================================
// Contact Information:
//			Author: Dwight Vietzke
//			Email:  dwight_vietzke@yahoo.com

/*
	OpenSiteMobile common dojo configuration file
*/


// --------------------------
// Dojo Toolkit Configuration
// --------------------------

var djConfig = {
    isDebug:false,
    locale:'en',
    msos_folder:'./msos',
    msos_content:'xhtml',
    msos_debug:false,
    msos_doctype:'xhtml_strict',
    msos_popups_blocked:false,
    msos_style:"<link rel='stylesheet' type='text/css' charset='utf-8' href='./msos/style/fubar.css' />\n<link rel='shortcut icon' href='./msos/images/osm.ico' />"
};


// --------------------------
// Google Adsense Configuration
// --------------------------

var google_ad_client = "pub-0581487774111572";
//234x60, created 11/20/07
var google_ad_slot = "7685348858";
var google_ad_width = 234;
var google_ad_height = 60;


// --------------------------
// Parse query string
// --------------------------

var get_query_string = function() {
    var query_string = location.search ? location.search : '';

    if (query_string.charAt(0) == '?')	query_string = query_string.substring(1);
    if (query_string)			query_string = decodeURIComponent(query_string);
    return query_string;
}

var parse_query = function() {
    var result = new Object();
    var params = new Array();
    var query = get_query_string();

    var is_empty = function(v) {
        if (typeof(v) == 'undefined')	return true;
	if (v == null)			return true;
	if (v == '')			return true;
	return false;
    };

    if (query) {
        params = query.split(/[&;]/g) || params.push(query);

        for (var idx = 0; idx < params.length; idx++) {
            var parm = params[idx].split("=");
            if (!is_empty(parm[0])) {
                if (parm[1] == 'true')  parm[1] = true;
                if (parm[1] == 'false') parm[1] = false;
                result[parm[0]] = parm[1];
            }
        }
    }

    for (var parm in djConfig) { if (result[parm]) djConfig[parm] = result[parm]; }
    return result;
}

djConfig.msos_query = parse_query();


// --------------------------
// Safari/Chrome console.debug fix,
// --------------------------

var safari_ua = navigator.userAgent.toLowerCase();
if (safari_ua.indexOf('safari') != -1) {
    // ref. Dojo Trac ticket #6849 (remove in the future?)
    window.console = {
        origConsole: window.console,
        log:    function(s){ this.origConsole.log(s);   },
        info:   function(s){ this.origConsole.info(s);  },
        error:  function(s){ this.origConsole.error(s); },
        warn:   function(s){ this.origConsole.warn(s);  }
    };
}